<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>后台管理</title>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/layui/css/layui.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/admin.css" />
<style>
.layui-form-label{ width:100px;}
.layui-input-block{ margin-left:130px;}
</style>
</head>
<body>
<div class="wrap-container">
  <form class="layui-form edit-form" method="post" action="{:url()}" style="width: 90%;padding-top: 20px;">
    
    <div class="layui-form-item">
      <label class="layui-form-label">代理ID：</label>
      <div class="layui-input-inline">
        <input type="number" name="aid" id="aid" value="" required lay-verify="required" placeholder="请输入代理商ID" autocomplete="off" class="layui-input">
      </div>
      <div class="layui-input-inline">
      <a href="javasrcipt:;" class="layui-btn layui-btn-primary kj_btn">选择代理商</a>
      </div>
    </div>
    
    <div class="layui-form-item">
      <label class="layui-form-label">应收金额：</label>
      <div class="layui-input-inline">
        <input type="number" name="receivable" value="" required lay-verify="required" placeholder="请输入应收金额" autocomplete="off" class="layui-input">
      </div>
	  <div class="layui-form-mid layui-word-aux" style="color:#f00">元</div>
    </div>
    
    <div class="layui-form-item">
      <label class="layui-form-label">提单类型：</label>
      <div class="layui-input-block">
        <input type="radio" name="type" value="0" title="手动提单" checked>
        <input type="radio" name="type" value="1" title="支付宝发码">
      </div>
    </div>
    
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal ajax-post-btn" lay-submit lay-filter="formDemo">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</div>
<script src="__STATIC__/js/jquery.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="__STATIC__/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC__/js/common.js" type="text/javascript" charset="utf-8"></script> 
<script>
			//Demo
			layui.use(['form','jquery','layer'], function() {
				var form = layui.form();
				var layer = layui.layer;
				form.render();
				//监听提交
				form.on('submit(formDemo)', function(data) {
					//layer.msg(JSON.stringify(data.field));
					var title = '<span style="color:#F00">请认真确认是否提交订单！</span>';
					var agbox = layer.confirm(title, {
								title:'提示信息',
								btn: ['确定','取消'] //按钮
					}, function(){
						//ajax_post('edit-form',false,'iframe131','');
						$.ajax({
							url:$('.edit-form').attr('action'),
							data:$('.edit-form').serialize(),
							type:'POST',
							success: function(data){
								if(data.code == 1){
									layer.msg(data.msg);
									if(data.data.code_url != ''){
										layer.open({
										  type: 1,
										  title: '支付二维码',
										  shadeClose: true,
										  shade: 0.3,
										  area: ['500px', '500px'],
										  content: '<div style="text-align:center"><img src="'+data.data.code_url+'" style="width:80%;"></div>'
										}); 
									}else{
										setInterval(function(){
											window.location.reload();	
										},2000);	
									}
								}else{
									layer.msg(data.msg);
								}	
							}
						});
						layer.close(agbox);
					}, function(){
						layer.close(agbox);
					});
					
					return false;
				});
				
				
				$('.kj_btn').on('click',function(){
					layer.open({
					  type: 2,
					  title: '快捷回复',
					  shadeClose: true,
					  shade: 0.3,
					  area: ['500px', '60%'],
					  content: "{:url('Agent/sel')}"
					}); 
					
					return false;
				})
			});

	
</script>


</body>
</html>